package com.woniuxy.driverschool.service.impl;
import com.woniuxy.driverschool.entity.StudyTime;
import com.woniuxy.driverschool.mapper.StudyTimeMapper;
import com.woniuxy.driverschool.service.StudyTimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author: xyq
 * @version: 1.0.0
 * @create: 2021/9/29 11:06
 * @description: TODO
 */
@Service
public class StudyTimeServiceImpl implements StudyTimeService {

    @Autowired
    StudyTimeMapper studyTimeMapper;

    //增添学时
    @Override
    public void addStudyTime(StudyTime studyTime) {
        studyTimeMapper.addStudyTime(studyTime);
    }

    //删除学时
    @Override
    public void removeStudyTime(int stid) {
        studyTimeMapper.removeStudyTime(stid);
    }

    //修改学员学时
    @Override
    public void updateStudyTime(int oneElapsedTime,int twoElapsedTime,int threeElapsedTime,int fourElapsedTime,String student,int stid)
    {
         studyTimeMapper.updateStudyTime(oneElapsedTime,twoElapsedTime,threeElapsedTime,fourElapsedTime,student,stid);
    }

    //通过id查询学员学时
    @Override
    public StudyTime selectStudyTimeByStid(int stid) {
        return studyTimeMapper.selectStudyTimeByStid(stid);
    }

    //分页查询学员学时
    @Override
    public List<StudyTime> selectAllStudyTimesByPage(StudyTime studyTime, Integer pageIndex, Integer pageSize, Date startTime, Date endTime) {
        return studyTimeMapper.selectAllStudyTimesByPage(studyTime, pageIndex, pageSize,startTime,endTime);
    }

    //查询学员学时总条数
    @Override
    public int selectCountStudyTimesByPage(StudyTime studyTime, Date startTime, Date endTime) {
        return studyTimeMapper.selectCountStudyTimesByPage(studyTime,startTime,endTime);
    }
}